﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace CheemsControl.Controls
{
    public class ControlAdjuster : UserControl
    {
        static ControlAdjuster()
        {
            BackgroundProperty.OverrideMetadata(
                typeof(MessageReminderRadioButton),
                new FrameworkPropertyMetadata(OnBackgroundEnChanged));
        }

        #region 控件宽
        /// <summary>
        /// 控件宽使能
        /// </summary>
        public bool ControlWidthEn
        {
            get { return (bool)GetValue(ControlWidthEnProperty); }
            set { SetValue(ControlWidthEnProperty, value); }
        }
        public static readonly DependencyProperty ControlWidthEnProperty =
            DependencyProperty.Register("ControlWidthEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnControlWidthEnChanged));


        /// <summary>
        /// 控件宽
        /// </summary>
        public double ControlWidth
        {
            get { return (double)GetValue(ControlWidthProperty); }
            set { SetValue(ControlWidthProperty, value); }
        }
        public static readonly DependencyProperty ControlWidthProperty =
            DependencyProperty.Register("ControlWidth", typeof(double), typeof(ControlAdjuster), new PropertyMetadata(100.0, OnControlWidthEnChanged));

        /// <summary>
        /// 控件宽可见性
        /// </summary>
        public Visibility ControlWidthVisibility
        {
            get { return (Visibility)GetValue(ControlWidthVisibilityProperty); }
            set { SetValue(ControlWidthVisibilityProperty, value); }
        }
        public static readonly DependencyProperty ControlWidthVisibilityProperty =
            DependencyProperty.Register("ControlWidthVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnControlWidthEnChanged));

        /// <summary>
        /// 控件宽使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnControlWidthEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            switch (thisControl.ControlWidthEn)
            {
                case true:
                    thisControl.ControlWidthVisibility = Visibility.Visible;
                    break;
                case false:
                    thisControl.ControlWidthVisibility = Visibility.Collapsed;
                    break;
            }
        }
        #endregion

        #region 控件高
        /// <summary>
        /// 控件高使能
        /// </summary>
        public bool ControlHeightEn
        {
            get { return (bool)GetValue(ControlHeightEnProperty); }
            set { SetValue(ControlHeightEnProperty, value); }
        }
        public static readonly DependencyProperty ControlHeightEnProperty =
            DependencyProperty.Register("ControlHeightEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnControlHeightEnChanged));


        /// <summary>
        /// 控件高
        /// </summary>
        public double ControlHeight
        {
            get { return (double)GetValue(ControlHeightProperty); }
            set { SetValue(ControlHeightProperty, value); }
        }
        public static readonly DependencyProperty ControlHeightProperty =
            DependencyProperty.Register("ControlHeight", typeof(double), typeof(ControlAdjuster), new PropertyMetadata(28.0, OnControlHeightEnChanged));

        /// <summary>
        /// 控件高可见性
        /// </summary>
        public Visibility ControlHeightVisibility
        {
            get { return (Visibility)GetValue(ControlHeightVisibilityProperty); }
            set { SetValue(ControlHeightVisibilityProperty, value); }
        }
        public static readonly DependencyProperty ControlHeightVisibilityProperty =
            DependencyProperty.Register("ControlHeightVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnControlHeightEnChanged));

        /// <summary>
        /// 控件高使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnControlHeightEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            switch (thisControl.ControlHeightEn)
            {
                case true:
                    thisControl.ControlHeightVisibility = Visibility.Visible;
                    break;
                case false:
                    thisControl.ControlHeightVisibility = Visibility.Collapsed;
                    break;
            }
        }
        #endregion

        #region 背景色
        /// <summary>
        /// 背景色使能
        /// </summary>
        public bool BackgroundEn
        {
            get { return (bool)GetValue(BackgroundEnProperty); }
            set { SetValue(BackgroundEnProperty, value); }
        }
        public static readonly DependencyProperty BackgroundEnProperty =
            DependencyProperty.Register("BackgroundEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnBackgroundEnChanged));

        /// <summary>
        /// 背景色可见性
        /// </summary>
        public Visibility BackgroundVisibility
        {
            get { return (Visibility)GetValue(BackgroundVisibilityProperty); }
            set { SetValue(BackgroundVisibilityProperty, value); }
        }
        public static readonly DependencyProperty BackgroundVisibilityProperty =
            DependencyProperty.Register("BackgroundVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnBackgroundEnChanged));

        /// <summary>
        /// 背景色使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnBackgroundEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            if (thisControl != null)
            {
                switch (thisControl.BackgroundEn)
                {
                    case true:
                        thisControl.BackgroundVisibility = Visibility.Visible;
                        break;
                    case false:
                        thisControl.BackgroundVisibility = Visibility.Collapsed;
                        break;
                }
            }
        }
        #endregion

        #region 副背景色
        /// <summary>
        /// 副背景色使能
        /// </summary>
        public bool SubBackgroundEn
        {
            get { return (bool)GetValue(SubBackgroundEnProperty); }
            set { SetValue(SubBackgroundEnProperty, value); }
        }
        public static readonly DependencyProperty SubBackgroundEnProperty =
            DependencyProperty.Register("SubBackgroundEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnSubBackgroundEnChanged));



        public Brush SubBackground
        {
            get { return (Brush)GetValue(SubBackgroundProperty); }
            set { SetValue(SubBackgroundProperty, value); }
        }

        // Using a DependencyProperty as the backing store for SubBackground.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty SubBackgroundProperty =
            DependencyProperty.Register("SubBackground", typeof(Brush), typeof(ControlAdjuster), new PropertyMetadata(null));



        /// <summary>
        /// 副背景色可见性
        /// </summary>
        public Visibility SubBackgroundVisibility
        {
            get { return (Visibility)GetValue(SubBackgroundVisibilityProperty); }
            set { SetValue(SubBackgroundVisibilityProperty, value); }
        }
        public static readonly DependencyProperty SubBackgroundVisibilityProperty =
            DependencyProperty.Register("SubBackgroundVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnSubBackgroundEnChanged));

        /// <summary>
        /// 副背景色使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnSubBackgroundEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            if (thisControl != null)
            {
                switch (thisControl.SubBackgroundEn)
                {
                    case true:
                        thisControl.SubBackgroundVisibility = Visibility.Visible;
                        break;
                    case false:
                        thisControl.SubBackgroundVisibility = Visibility.Collapsed;
                        break;
                }
            }
        }
        #endregion

        #region 主文本
        /// <summary>
        /// 主文本使能
        /// </summary>
        public bool TextEn
        {
            get { return (bool)GetValue(TextEnProperty); }
            set { SetValue(TextEnProperty, value); }
        }
        public static readonly DependencyProperty TextEnProperty =
            DependencyProperty.Register("TextEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnTextEnChanged));


        /// <summary>
        /// 主文本
        /// </summary>
        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }
        public static readonly DependencyProperty TextProperty =
            DependencyProperty.Register("Text", typeof(string), typeof(ControlAdjuster), new PropertyMetadata("\ue8c7", OnTextEnChanged));

        /// <summary>
        /// 主文本可见性
        /// </summary>
        public Visibility TextVisibility
        {
            get { return (Visibility)GetValue(TextVisibilityProperty); }
            set { SetValue(TextVisibilityProperty, value); }
        }
        public static readonly DependencyProperty TextVisibilityProperty =
            DependencyProperty.Register("TextVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnTextEnChanged));

        /// <summary>
        /// 主文本使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnTextEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            switch (thisControl.TextEn)
            {
                case true:
                    thisControl.TextVisibility = Visibility.Visible;
                    break;
                case false:
                    thisControl.TextVisibility = Visibility.Collapsed;
                    break;
            }
        }
        #endregion

        #region 主文本字体
        /// <summary>
        /// 主文本字体使能
        /// </summary>
        public bool TextFontSizeEn
        {
            get { return (bool)GetValue(TextFontSizeEnProperty); }
            set { SetValue(TextFontSizeEnProperty, value); }
        }
        public static readonly DependencyProperty TextFontSizeEnProperty =
            DependencyProperty.Register("TextFontSizeEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnTextFontSizeEnChanged));


        /// <summary>
        /// 主文本字体
        /// </summary>
        public double TextFontSize
        {
            get { return (double)GetValue(TextFontSizeProperty); }
            set { SetValue(TextFontSizeProperty, value); }
        }
        public static readonly DependencyProperty TextFontSizeProperty =
            DependencyProperty.Register("TextFontSize", typeof(double), typeof(ControlAdjuster), new PropertyMetadata(20.0, OnTextFontSizeEnChanged));

        /// <summary>
        /// 主文本字体可见性
        /// </summary>
        public Visibility TextFontSizeVisibility
        {
            get { return (Visibility)GetValue(TextFontSizeVisibilityProperty); }
            set { SetValue(TextFontSizeVisibilityProperty, value); }
        }
        public static readonly DependencyProperty TextFontSizeVisibilityProperty =
            DependencyProperty.Register("TextFontSizeVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnTextFontSizeEnChanged));

        /// <summary>
        /// 主文本字体使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnTextFontSizeEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            switch (thisControl.TextFontSizeEn)
            {
                case true:
                    thisControl.TextFontSizeVisibility = Visibility.Visible;
                    break;
                case false:
                    thisControl.TextFontSizeVisibility = Visibility.Collapsed;
                    break;
            }
        }
        #endregion

        #region 主文本颜色
        /// <summary>
        /// 主文本颜色使能
        /// </summary>
        public bool TextForegroundEn
        {
            get { return (bool)GetValue(TextForegroundEnProperty); }
            set { SetValue(TextForegroundEnProperty, value); }
        }
        public static readonly DependencyProperty TextForegroundEnProperty =
            DependencyProperty.Register("TextForegroundEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnTextForegroundEnChanged));


        /// <summary>
        /// 主文本颜色
        /// </summary>
        public Brush TextForeground
        {
            get { return (Brush)GetValue(TextForegroundProperty); }
            set { SetValue(TextForegroundProperty, value); }
        }
        public static readonly DependencyProperty TextForegroundProperty =
            DependencyProperty.Register("TextForeground", typeof(Brush), typeof(ControlAdjuster), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(0xFF,0x66,0x66,0x66)), OnTextForegroundEnChanged));

        /// <summary>
        /// 主文本颜色可见性
        /// </summary>
        public Visibility TextForegroundVisibility
        {
            get { return (Visibility)GetValue(TextForegroundVisibilityProperty); }
            set { SetValue(TextForegroundVisibilityProperty, value); }
        }
        public static readonly DependencyProperty TextForegroundVisibilityProperty =
            DependencyProperty.Register("TextForegroundVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnTextForegroundEnChanged));

        /// <summary>
        /// 主文本颜色使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnTextForegroundEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            switch (thisControl.TextForegroundEn)
            {
                case true:
                    thisControl.TextForegroundVisibility = Visibility.Visible;
                    break;
                case false:
                    thisControl.TextForegroundVisibility = Visibility.Collapsed;
                    break;
            }
        }
        #endregion

        #region 副文本
        /// <summary>
        /// 副文本使能
        /// </summary>
        public bool SubtextEn
        {
            get { return (bool)GetValue(SubtextEnProperty); }
            set { SetValue(SubtextEnProperty, value); }
        }
        public static readonly DependencyProperty SubtextEnProperty =
            DependencyProperty.Register("SubtextEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnSubtextEnChanged));


        /// <summary>
        /// 副文本
        /// </summary>
        public string Subtext
        {
            get { return (string)GetValue(SubtextProperty); }
            set { SetValue(SubtextProperty, value); }
        }
        public static readonly DependencyProperty SubtextProperty =
            DependencyProperty.Register("Subtext", typeof(string), typeof(ControlAdjuster), new PropertyMetadata("\ue8c7", OnSubtextEnChanged));

        /// <summary>
        /// 副文本可见性
        /// </summary>
        public Visibility SubtextVisibility
        {
            get { return (Visibility)GetValue(SubtextVisibilityProperty); }
            set { SetValue(SubtextVisibilityProperty, value); }
        }
        public static readonly DependencyProperty SubtextVisibilityProperty =
            DependencyProperty.Register("SubtextVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnSubtextEnChanged));

        /// <summary>
        /// 副文本使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnSubtextEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            switch (thisControl.SubtextEn)
            {
                case true:
                    thisControl.SubtextVisibility = Visibility.Visible;
                    break;
                case false:
                    thisControl.SubtextVisibility = Visibility.Collapsed;
                    break;
            }
        }
        #endregion

        #region 副文本颜色
        /// <summary>
        /// 副文本颜色使能
        /// </summary>
        public bool SubtextForegroundEn
        {
            get { return (bool)GetValue(SubtextForegroundEnProperty); }
            set { SetValue(SubtextForegroundEnProperty, value); }
        }
        public static readonly DependencyProperty SubtextForegroundEnProperty =
            DependencyProperty.Register("SubtextForegroundEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnSubtextForegroundEnChanged));


        /// <summary>
        /// 副文本颜色
        /// </summary>
        public Brush SubtextForeground
        {
            get { return (Brush)GetValue(SubtextForegroundProperty); }
            set { SetValue(SubtextForegroundProperty, value); }
        }
        public static readonly DependencyProperty SubtextForegroundProperty =
            DependencyProperty.Register("SubtextForeground", typeof(Brush), typeof(ControlAdjuster), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(0xFF, 0x66, 0x66, 0x66)), OnSubtextForegroundEnChanged));

        /// <summary>
        /// 副文本颜色可见性
        /// </summary>
        public Visibility SubtextForegroundVisibility
        {
            get { return (Visibility)GetValue(SubtextForegroundVisibilityProperty); }
            set { SetValue(SubtextForegroundVisibilityProperty, value); }
        }
        public static readonly DependencyProperty SubtextForegroundVisibilityProperty =
            DependencyProperty.Register("SubtextForegroundVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnSubtextForegroundEnChanged));

        /// <summary>
        /// 副文本颜色使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnSubtextForegroundEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            switch (thisControl.SubtextForegroundEn)
            {
                case true:
                    thisControl.SubtextForegroundVisibility = Visibility.Visible;
                    break;
                case false:
                    thisControl.SubtextForegroundVisibility = Visibility.Collapsed;
                    break;
            }
        }
        #endregion

        #region 控件圆角
        /// <summary>
        /// 控件圆角使能
        /// </summary>
        public bool CornerRadiusEn
        {
            get { return (bool)GetValue(CornerRadiusEnProperty); }
            set { SetValue(CornerRadiusEnProperty, value); }
        }
        public static readonly DependencyProperty CornerRadiusEnProperty =
            DependencyProperty.Register("CornerRadiusEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnCornerRadiusEnChanged));


        /// <summary>
        /// 控件圆角
        /// </summary>
        public CornerRadius CornerRadius
        {
            get { return (CornerRadius)GetValue(CornerRadiusProperty); }
            set { SetValue(CornerRadiusProperty, value); }
        }
        public static readonly DependencyProperty CornerRadiusProperty =
            DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(ControlAdjuster), new PropertyMetadata(new CornerRadius(5), OnCornerRadiusEnChanged));

        /// <summary>
        /// 控件圆角可见性
        /// </summary>
        public Visibility CornerRadiusVisibility
        {
            get { return (Visibility)GetValue(CornerRadiusVisibilityProperty); }
            set { SetValue(CornerRadiusVisibilityProperty, value); }
        }
        public static readonly DependencyProperty CornerRadiusVisibilityProperty =
            DependencyProperty.Register("CornerRadiusVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnCornerRadiusEnChanged));

        /// <summary>
        /// 控件圆角使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnCornerRadiusEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            switch (thisControl.CornerRadiusEn)
            {
                case true:
                    thisControl.CornerRadiusVisibility = Visibility.Visible;
                    break;
                case false:
                    thisControl.CornerRadiusVisibility = Visibility.Collapsed;
                    break;
            }
        }
        #endregion

        #region 副圆角
        /// <summary>
        /// 副圆角使能
        /// </summary>
        public bool SubCornerRadiusEn
        {
            get { return (bool)GetValue(SubCornerRadiusEnProperty); }
            set { SetValue(SubCornerRadiusEnProperty, value); }
        }
        public static readonly DependencyProperty SubCornerRadiusEnProperty =
            DependencyProperty.Register("SubCornerRadiusEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnSubCornerRadiusEnChanged));


        /// <summary>
        /// 副圆角
        /// </summary>
        public CornerRadius SubCornerRadius
        {
            get { return (CornerRadius)GetValue(SubCornerRadiusProperty); }
            set { SetValue(SubCornerRadiusProperty, value); }
        }
        public static readonly DependencyProperty SubCornerRadiusProperty =
            DependencyProperty.Register("SubCornerRadius", typeof(CornerRadius), typeof(ControlAdjuster), new PropertyMetadata(new CornerRadius(5), OnSubCornerRadiusEnChanged));

        /// <summary>
        /// 副圆角可见性
        /// </summary>
        public Visibility SubCornerRadiusVisibility
        {
            get { return (Visibility)GetValue(SubCornerRadiusVisibilityProperty); }
            set { SetValue(SubCornerRadiusVisibilityProperty, value); }
        }
        public static readonly DependencyProperty SubCornerRadiusVisibilityProperty =
            DependencyProperty.Register("SubCornerRadiusVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnSubCornerRadiusEnChanged));

        /// <summary>
        /// 副圆角使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnSubCornerRadiusEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            switch (thisControl.SubCornerRadiusEn)
            {
                case true:
                    thisControl.SubCornerRadiusVisibility = Visibility.Visible;
                    break;
                case false:
                    thisControl.SubCornerRadiusVisibility = Visibility.Collapsed;
                    break;
            }
        }
        #endregion

        #region 边框粗细
        /// <summary>
        /// 边框粗细使能
        /// </summary>
        public bool BorderThicknessEn
        {
            get { return (bool)GetValue(BorderThicknessEnProperty); }
            set { SetValue(BorderThicknessEnProperty, value); }
        }
        public static readonly DependencyProperty BorderThicknessEnProperty =
            DependencyProperty.Register("BorderThicknessEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnBorderThicknessEnChanged));


        /// <summary>
        /// 边框粗细
        /// </summary>
        public Thickness BorderThickness
        {
            get { return (Thickness)GetValue(BorderThicknessProperty); }
            set { SetValue(BorderThicknessProperty, value); }
        }
        public static readonly DependencyProperty BorderThicknessProperty =
            DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(ControlAdjuster), new PropertyMetadata(new Thickness(1), OnBorderThicknessEnChanged));

        /// <summary>
        /// 边框粗细可见性
        /// </summary>
        public Visibility BorderThicknessVisibility
        {
            get { return (Visibility)GetValue(BorderThicknessVisibilityProperty); }
            set { SetValue(BorderThicknessVisibilityProperty, value); }
        }
        public static readonly DependencyProperty BorderThicknessVisibilityProperty =
            DependencyProperty.Register("BorderThicknessVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnBorderThicknessEnChanged));

        /// <summary>
        /// 边框粗细使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnBorderThicknessEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            switch (thisControl.BorderThicknessEn)
            {
                case true:
                    thisControl.BorderThicknessVisibility = Visibility.Visible;
                    break;
                case false:
                    thisControl.BorderThicknessVisibility = Visibility.Collapsed;
                    break;
            }
        }
        #endregion

        #region 边框颜色
        /// <summary>
        /// 边框颜色使能
        /// </summary>
        public bool BorderBrushEn
        {
            get { return (bool)GetValue(BorderBrushEnProperty); }
            set { SetValue(BorderBrushEnProperty, value); }
        }
        public static readonly DependencyProperty BorderBrushEnProperty =
            DependencyProperty.Register("BorderBrushEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnBorderBrushEnChanged));


        /// <summary>
        /// 边框颜色
        /// </summary>
        public Brush BorderBrush
        {
            get { return (Brush)GetValue(BorderBrushProperty); }
            set { SetValue(BorderBrushProperty, value); }
        }
        public static readonly DependencyProperty BorderBrushProperty =
            DependencyProperty.Register("BorderBrush", typeof(Brush), typeof(ControlAdjuster), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(0xFF, 0x66, 0x66, 0x66)), OnBorderBrushEnChanged));

        /// <summary>
        /// 边框颜色可见性
        /// </summary>
        public Visibility BorderBrushVisibility
        {
            get { return (Visibility)GetValue(BorderBrushVisibilityProperty); }
            set { SetValue(BorderBrushVisibilityProperty, value); }
        }
        public static readonly DependencyProperty BorderBrushVisibilityProperty =
            DependencyProperty.Register("BorderBrushVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnBorderBrushEnChanged));

        /// <summary>
        /// 边框颜色使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnBorderBrushEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            switch (thisControl.BorderBrushEn)
            {
                case true:
                    thisControl.BorderBrushVisibility = Visibility.Visible;
                    break;
                case false:
                    thisControl.BorderBrushVisibility = Visibility.Collapsed;
                    break;
            }
        }
        #endregion

        #region 值
        /// <summary>
        /// 值使能
        /// </summary>
        public bool ValueEn
        {
            get { return (bool)GetValue(ValueEnProperty); }
            set { SetValue(ValueEnProperty, value); }
        }
        public static readonly DependencyProperty ValueEnProperty =
            DependencyProperty.Register("ValueEn", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false, OnValueEnChanged));


        /// <summary>
        /// 值
        /// </summary>
        public double Value
        {
            get { return (double)GetValue(ValueProperty); }
            set { SetValue(ValueProperty, value); }
        }
        public static readonly DependencyProperty ValueProperty =
            DependencyProperty.Register("Value", typeof(double), typeof(ControlAdjuster), new PropertyMetadata(20.0, OnValueEnChanged));

        /// <summary>
        /// 值可见性
        /// </summary>
        public Visibility ValueVisibility
        {
            get { return (Visibility)GetValue(ValueVisibilityProperty); }
            set { SetValue(ValueVisibilityProperty, value); }
        }
        public static readonly DependencyProperty ValueVisibilityProperty =
            DependencyProperty.Register("ValueVisibility", typeof(Visibility), typeof(ControlAdjuster), new PropertyMetadata(Visibility.Collapsed, OnValueEnChanged));

        /// <summary>
        /// 值使能开关
        /// </summary>
        /// <param name="d"></param>
        /// <param name="e"></param>
        private static void OnValueEnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ControlAdjuster thisControl = d as ControlAdjuster;
            switch (thisControl.ValueEn)
            {
                case true:
                    thisControl.ValueVisibility = Visibility.Visible;
                    break;
                case false:
                    thisControl.ValueVisibility = Visibility.Collapsed;
                    break;
            }
        }
        #endregion

        #region 自身属性：动画开关
        /// <summary>
        /// 是否打开动画
        /// </summary>
        public bool IsAnimationEnabled
        {
            get { return (bool)GetValue(IsAnimationEnabledProperty); }
            set { SetValue(IsAnimationEnabledProperty, value); }
        }
        public static readonly DependencyProperty IsAnimationEnabledProperty =
            DependencyProperty.Register("IsAnimationEnabled", typeof(bool), typeof(ControlAdjuster), new PropertyMetadata(false));
        #endregion

    }
}
